﻿<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:Controls="clr-namespace:jSLCore.Client.Presentation.Controls"
                        xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
    mc:Ignorable="d">
    
<!--Some controls appear in different way in wpf, that is the second reason, why this file is not linked.
    The first reason is that the system does not see generic.xaml and does not apply default styles to our controls, if the file is linked-->

    <Style TargetType="Controls:ErrorBorder">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="Controls:ErrorBorder">
                    <Border BorderThickness="1" UseLayoutRounding="True"
                            ToolTipService.ToolTip="{TemplateBinding ToolTip}"
                            BorderBrush="{TemplateBinding BorderBrush}" Margin="-1">
                        <Grid Margin="0">
                            <ContentPresenter
                            Content="{TemplateBinding Content}"
                            ContentTemplate="{TemplateBinding ContentTemplate}"
                            HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
                            VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
                            Margin="{TemplateBinding Padding}"/>
                            <Polyline Fill="{TemplateBinding BorderBrush}" HorizontalAlignment="Right" VerticalAlignment="Top">
                                <Polyline.Points>
                                    <Point X="0" Y="0"/>
                                    <Point X="4" Y="0"/>
                                    <Point X="4" Y="4"/>
                                    <Point X="0" Y="0"/>
                                </Polyline.Points>
                            </Polyline>
                        </Grid>
                    </Border>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
    <Style TargetType="Controls:jNullableBox">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="Controls:jNullableBox">
                    <Grid>
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition/>
                            <ColumnDefinition Width="auto"/>
                        </Grid.ColumnDefinitions>
                        <Controls:DeleteButton Grid.Column="1" x:Name="PART_deleteButton"/>
                        <ContentPresenter 
                            Content="{TemplateBinding Content}" 
                            ContentTemplate="{TemplateBinding ContentTemplate}"/>
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
    <Style TargetType="Controls:ImageButton">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="Controls:ImageButtonBase">
                    <Grid Margin="{TemplateBinding Margin}" Cursor="Hand">
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="auto"/>
                            <ColumnDefinition/>
                        </Grid.ColumnDefinitions>
                        <Image x:Name="PART_image" 
                       Stretch="Fill" 
                       Source="{TemplateBinding Image}"                        
                           Grid.Column="0" 
                           Width="{TemplateBinding ImageWidth}"
                           Height="{TemplateBinding ImageHeight}"/>
                        <ContentPresenter
                    VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
                    HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
                    Margin="{TemplateBinding Padding}"
                    Grid.Column="1" 
                                  Content="{TemplateBinding Content}"
                                  ContentTemplate="{TemplateBinding ContentTemplate}"/>
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style TargetType="Controls:ImageGroupBox">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="Controls:ImageGroupBoxBase">
                    <Border BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="2" Background="{TemplateBinding Background}" CornerRadius="{TemplateBinding CornerRadius}">
                        <Grid>
                            <Grid.RowDefinitions>
                                <RowDefinition Height="auto"/>
                                <RowDefinition/>
                            </Grid.RowDefinitions>
                            <Border Grid.Row="0" Background="{TemplateBinding BorderBrush}">
                                <Grid>
                                    <Grid.ColumnDefinitions>
                                        <ColumnDefinition Width="auto"/>
                                        <ColumnDefinition/>
                                    </Grid.ColumnDefinitions>

                                    <Image Grid.Column="0" Margin="5,2,5,2" Stretch="Fill" Source="{TemplateBinding ImageSource}" Height="15"/>
                                    <ContentPresenter Grid.Column="1" Content="{TemplateBinding Header}" VerticalAlignment="Center" Margin="5,2,50,2"/>
                                </Grid>
                            </Border>
                            <ScrollViewer 
                                Grid.Row="1"
                                VerticalScrollBarVisibility="{TemplateBinding ScrollBarVisible}"
                                HorizontalScrollBarVisibility="{TemplateBinding ScrollBarVisible}"
                                BorderThickness="0"
                                          >
                                <ContentPresenter  
                                                  Content="{TemplateBinding Content}"
                                                  ContentTemplate="{TemplateBinding ContentTemplate}"
                                                  Cursor="{TemplateBinding Cursor}"
                                                  Margin="{TemplateBinding Padding}"
                                                  HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
                                                  VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>
                            </ScrollViewer>
                        </Grid>
                    </Border>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style TargetType="Controls:ImageHeader">
        <Setter Property="Padding" Value="75,0,0,0"/>
        <Setter Property="RenderTransformOrigin" Value="0.5,0.5"/>
        <Setter Property="Background" Value="LightSteelBlue"/>
        <Setter Property="VerticalContentAlignment" Value="Center"/>
        <Setter Property="HorizontalContentAlignment" Value="Left"/>
        <Setter Property="RenderTransform">
            <Setter.Value>
                <ScaleTransform ScaleX="1.4" ScaleY="1.4"/>
            </Setter.Value>
        </Setter>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="Controls:ImageHeader">
                    <Grid Margin="{TemplateBinding Margin}">
                        <Border VerticalAlignment="Center" MinHeight="25" Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" CornerRadius="{TemplateBinding CornerRadius}">
                            <TextBlock Margin="{TemplateBinding Padding}" 
                                       Text="{TemplateBinding Header}" 
                                       Foreground="{TemplateBinding Foreground}"                                        
                                       HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" 
                                       VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>
                        </Border>
                        <Grid Margin="30,0,0,0" Width="40" Height="40" HorizontalAlignment="Left">
                            <Ellipse 
                                Stretch="Fill" 
                                StrokeThickness="{TemplateBinding BorderThickness}"
                                Stroke="{TemplateBinding BorderBrush}" 
                                Fill="{TemplateBinding Background}"/>


                            <Image Source="{TemplateBinding Image}" Stretch="Fill" Margin="5"/>
                        </Grid>
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style TargetType="Controls:jSLCloseDialogButton">
        <Setter Property="Content" Value="x"/>
       <!-- <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="Controls:jSLCloseDialogButton">
                    <Border Background="{TemplateBinding Background}"
                            BorderBrush="{TemplateBinding BorderBrush}"
                            BorderThickness="{TemplateBinding BorderThickness}">
                        <ContentPresenter Content="{TemplateBinding Content}" 
                                          ContentTemplate="{TemplateBinding ContentTemplate}"
                                          VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
                                          HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"/>
                    </Border>
                </ControlTemplate>
            </Setter.Value>
        </Setter>-->
    </Style>
</ResourceDictionary>